var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
    })(t, e);
}, function(t, e) {
    function n() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, 
    new n());
}), a = this && this.__decorate || function(t, e, n, c) {
    var i, o = arguments.length, a = o < 3 ? e : null === c ? c = Object.getOwnPropertyDescriptor(e, n) : c;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(t, e, n, c); else for (var r = t.length - 1; 0 <= r; r--) (i = t[r]) && (a = (o < 3 ? i(a) : 3 < o ? i(e, n, a) : i(e, n)) || a);
    return 3 < o && a && Object.defineProperty(e, n, a), a;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("GameConfig"), s = e("GameData"), c = e("ActivityManager"), l = e("AudioManager"), d = e("UIManager"), u = e("DrawView"), p = cc._decorator, h = p.ccclass, f = p.property, g = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.countLabel = null, t.type = c.ActivityType.CHRISTMAS, t;
    }
    return i(t, e), t.prototype.onClick = function() {
        l.default.getInstance().playAudio("按钮2"), c.ActivityManager.getInstance().checkActivity(c.ActivityType.CHRISTMAS) && this.type == c.ActivityType.CHRISTMAS && s.GD.christmasSkinCount >= r.GC.christmasSkinCount ? d.default.getInstance().loadPnl("draw").then(function(t) {
            var e = t.getComponent(u.default);
            e && (e.drawType = "gun", e.gunToggle.getComponent(cc.Toggle).isChecked = !0, e.scheduleOnce(function() {
                e.showToggle(2);
            }));
        }) : c.ActivityManager.getInstance().checkActivity(c.ActivityType.NEWYEAR) && this.type == c.ActivityType.NEWYEAR && s.GD.newYearSkinCount >= r.GC.newYearSkinCount && d.default.getInstance().loadPnl("draw").then(function(t) {
            var e = t.getComponent(u.default);
            e && (e.drawType = "gun", e.gunToggle.getComponent(cc.Toggle).isChecked = !0, e.scheduleOnce(function() {
                e.showToggle(3);
            }));
        });
    }, t.prototype.onLoad = function() {
        c.ActivityManager.getInstance().checkActivity(c.ActivityType.CHRISTMAS) || c.ActivityManager.getInstance().checkActivity(c.ActivityType.NEWYEAR) ? (this.doRefresh(), 
        cc.systemEvent.on("change_person_skin", this.doRefresh, this)) : this.node.destroy();
    }, t.prototype.onEnable = function() {
        c.ActivityManager.getInstance().checkActivity(c.ActivityType.CHRISTMAS) && this.type == c.ActivityType.CHRISTMAS ? s.GD.christmasSkinCount >= r.GC.christmasSkinCount ? this.countLabel.string = "立刻抽奖" : this.countLabel.string = "已使用" + s.GD.christmasSkinCount + "次" : c.ActivityManager.getInstance().checkActivity(c.ActivityType.NEWYEAR) && this.type == c.ActivityType.NEWYEAR && (s.GD.newYearSkinCount >= r.GC.newYearSkinCount ? this.countLabel.string = "立刻抽奖" : this.countLabel.string = "已使用" + s.GD.newYearSkinCount + "次");
    }, t.prototype.start = function() {}, t.prototype.doRefresh = function() {
        c.ActivityManager.getInstance().checkActivity(c.ActivityType.NEWYEAR) ? 5 == s.GD.personIdx ? (this.type = c.ActivityType.NEWYEAR, 
        this.node.active = !0) : this.node.active = !1 : c.ActivityManager.getInstance().checkActivity(c.ActivityType.CHRISTMAS) && 4 == s.GD.personIdx ? (this.type = c.ActivityType.CHRISTMAS, 
        this.node.active = !0) : this.node.active = !1;
    }, a([ f(cc.Label) ], t.prototype, "countLabel", void 0), a([ h ], t);
}(cc.Component);

n.default = g;